import { UPDATECITY } from './type'
import Vue from 'vue'
export default {
    updateCityAsync({ commit, state }, { city }) {
        if (!city.name) {
            city.name = state.name
            city.rN = state.rN
        }
        return Vue.prototype.$axios.get(`/movie/hot/?city=${city.rN}`).then(res=>{
            // console.log(res.data)
            let lists=res.data.data.data.returnValue
            // 模拟索引数据id
            lists.forEach((item,index)=>{
                // console.log(index)
                item.mId=index
            })
            city.data=lists
            commit(UPDATECITY,{city})
        })
    }
}